//
//  LOLFavorTableViewCell.m
//  LOLXXbox
//
//  Created by mac on 16/2/29.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLFavorTableViewCell.h"
#import <UIImageView+WebCache.h>
#import "LSZDataBaseSinglenton.h"
#define HEROHEADURL(name) [NSString stringWithFormat:@"http://img.lolbox.duowan.com/champions/%@_120x120.jpg",name]
#define WIDTH [[UIScreen mainScreen]bounds].size.width

@implementation LOLFavorTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self) {
         self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
        self.headimage = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.headimage];
        self.name = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.name];
        self.label = [[UILabel alloc] init];
        self.label.textColor = [UIColor whiteColor];
        self.label.backgroundColor = [UIColor colorWithRed:0.106 green:0.626 blue:0.921 alpha:0.850];
        self.label.font = [UIFont systemFontOfSize:14];
        self.label.textAlignment = NSTextAlignmentCenter;
        self.label.layer.cornerRadius = 5;
        self.label.layer.masksToBounds = NO;
        [self.contentView addSubview:self.label];
        
    }
    return self;

}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.headimage.frame = CGRectMake(8, 5, 75, 75);
    self.name.frame = CGRectMake(100, 10, 120, 25);
    self.label.frame = CGRectMake(WIDTH/1.60, 48, 110, 30);
    
}

-(void)setDataSource:(NSArray *)DataSource{
    _DataSource = DataSource;
    [_headimage sd_setImageWithURL:[NSURL URLWithString:HEROHEADURL(DataSource[0])]];
    _name.text = DataSource[1];
    _label.text = @"点击查看详情";
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
